package ch01.ts;

import javax.xml.ws.Endpoint;

import ch01.ts.TimeServerImpl;

public class TimePublisherMultiThreaded {
	// MT for multithreaded
	private Endpoint endpoint;

	public static void main(String[] args) {
		TimePublisherMultiThreaded self = new TimePublisherMultiThreaded();
		self.create_endpoint();
		self.configure_endpoint();
		self.publish();
	}

	private void create_endpoint() {
		endpoint = Endpoint.create(new TimeServerImpl());
	}

	private void configure_endpoint() {
		endpoint.setExecutor(new MyThreadPool());
	}

	private void publish() {
		int port = 8888;
		String url = "http://localhost:" + port + "/ts";
		endpoint.publish(url);
		System.out.println("Publishing TimeServer on port " + port);
	}
}
